package com.safone.thirdattendanceservices.common.controllers;


import com.cqsudu.lightning.service.validate.Insert;
import com.safone.thirdattendancecores.common.dtos.PersonQueryDto;
import com.safone.thirdattendanceservices.common.services.CommonService;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 第三方公钥、mq数据接口
 * @author xy
 * @date 2020/12/4 20:16
 */
@RestController
@AllArgsConstructor
@RequestMapping(value = "/api/safe/external/open/dh")
public class CommonController {

    private CommonService commonService;

    /**
     * 获取随机公钥
     * @return
     */
    @GetMapping(value = "/publicKey/get")
    public String getRandomPublicKey(){
        return commonService.getRandomPublicKey();
    }

    /**
     * 获取mq
     * @return
     */
    @GetMapping(value = "/mq/get")
    public Object getMq(){
        return commonService.getMq();
    }

    /**
     * 查询人员信息
     * @param personQueryDto
     * @return
     */
    @PostMapping(value = "/person/find")
    public Object findPerson(@RequestBody @Validated({Insert.class})PersonQueryDto personQueryDto){
        return commonService.findPerson(personQueryDto);
    }

    /**
     * 分页查询人脸库
     * @return
     */
    @GetMapping(value = "/face/repository/find8page")
    public Object findFaceRepository(){
        return commonService.findFaceRepository();
    }

    /**
     * 分页查询人脸库人员
     * @return
     */
    @GetMapping(value = "/face/repository/find8repositoryId")
    public Object findFaceRepositoryPerson(){
        return commonService.findFaceRepositoryPerson();
    }

}
